import { defHttp } from '@/utils/http/axios';
enum Api {
  getMatchCategoryPageAPI = '/mv/data/matchCategoryPage',
  getmatchCategoryAPI = '/mv/data/matchCategory',
  getdeviceToOwnerAPI = '/mc/device/select',
  getCommentMarchPageAPI = '/mv/taskMarket/commentMarchPage',
}
export function getMatchCategoryPageAPI(params) {
  params['current'] = params.page;
  params['size'] = params.pageSize;
  return defHttp
    .post(
      {
        url: Api.getMatchCategoryPageAPI,
        params,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      const { records, total } = res.data;
      return {
        items: records, // 将数据列表赋值给 items
        total, // 直接使用 total
      };
    })
    .catch((err) => {
      console.log(err, '虚拟机');
    });
}

//获取所有数据
export function getMatchCategoryPageAPICheck(params) {
  return defHttp
    .post(
      {
        url: Api.getMatchCategoryPageAPI,
        params,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      const { records, total } = res.data;
      return {
        items: records, // 将数据列表赋值给 items
        total, // 直接使用 total
      };
    });
}
export function getmatchCategoryAPI() {
  return defHttp
    .get(
      {
        url: Api.getmatchCategoryAPI,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      return res;
    });
}
export function getdeviceToOwnerAPI() {
  return defHttp
    .get(
      {
        url: Api.getdeviceToOwnerAPI,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      return res;
    });
}
export function getCommentMarchPageAPI(params) {
  params['current'] = params.page;
  params['size'] = params.pageSize;
  return defHttp
    .post(
      {
        url: Api.getCommentMarchPageAPI,
        params,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      const { records, total } = res.data;
      return {
        items: records, // 将数据列表赋值给 items
        total, // 直接使用 total
      };
    })
    .catch((err) => {
      console.log(err, '虚拟机');
    });
}
//获取所有数据
export function getCommentMarchPageAPICheck(params) {
  return defHttp
    .post(
      {
        url: Api.getCommentMarchPageAPI,
        params,
      },
      {
        isTransformResponse: false,
      },
    )
    .then((res) => {
      const { records, total } = res.data;
      return {
        items: records, // 将数据列表赋值给 items
        total, // 直接使用 total
      };
    })
}

